/************************************************************************/
/*  									*/
/*  round_integer.c							*/
/*									*/
/*  Tom Lookabaugh							*/
/*  January 30, 1987							*/
/*  Last Revision: January 30, 1988					*/
/*									*/
/*  DESCRIPTION								*/
/*	Rounds a vector of doubles to a vector of shorts.  The 		*/
/*	parameter DATATYPE must be "short" or "int"  in stdvq.h		*/
/*  RETURNS								*/
/*	No significant value.  						*/
/*  CALLS								*/
/*	error()								*/
/*									*/
/************************************************************************/

#include "stdvq.h"
#include <math.h>

round (tsvect, tsvects, dimen)

    double* tsvect;     /* source vector 		                */
    DATATYPE* tsvects;  /* target vector         		        */
    int dimen;		/* vector dimension				*/
    
{
   int d;
   DATATYPE sts;

   for (d = 0; d < dimen; d++) {
       sts = (DATATYPE) floor(tsvect[d]);
       tsvects[d] = ((tsvect[d] - (double) sts) < 0.5) ? sts : sts + 1;
}
